﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using ASG.CodeGenerator.SQL.TSQL;

namespace ASG.CodeGenerator.UI.Desktop.TSQLTest
{
    public partial class CredentialsForm : Form
    {
        SQLServerCredentials _Credentials;

        public SQLServerCredentials Credentials
        {
            get { return _Credentials; }
            set { _Credentials = value; }
        }

        public CredentialsForm()
        {
            InitializeComponent();
        }

        private void chkIntegrated_CheckedChanged(object sender, EventArgs e)
        {
            txtPass.Enabled = !chkIntegrated.Checked;
            txtUserID.Enabled = !chkIntegrated.Checked;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            _Credentials = new SQLServerCredentials(chkIntegrated.Checked, chkPersist.Checked, txtUserID.Text, txtPass.Text);
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.Cancel;
        }
    }
}
